/*
 * Copyright (c) 2020, 2023, 3044483124@qq.com All rights reserved.
 *
 */
package cn.itcast;

import java.io.File;

/**
 * <p>Project: JavaStudy - DirDele2
 * <p>Powered by jiangbo On 2023-01-03
 * 20:56:52
 * <p>Created by IntelliJ IDEA
 *
 * @author jiangbo [3044483124@qq.com]
 * @version 1.0
 * @since 8/17
 */
public class DirDele2 {
    public static void main(String[] args) {
        delDir(new File("user"));
    }
    public static void delDir(File path) {
        if (path.isFile()) {

            path.delete();
            return;
        }
        if(path.isDirectory()) {
            for (File f : path.listFiles()) {
                if (f.isDirectory()) {
                    delDir(f);
                }
                f.delete();
            }
        }
        path.delete();

     }
}


